<?php
/**
 * Represents a basic html list .
 */
class fily_BasicList extends fily_ControlContainer {
    /**
     * tag for items
     * @var <type>
     */
    protected $itemTag;

    /**
     *
     * @param string $tag tag for the control
     * @param string $itemTag tag for the items
     */
    public function __construct($tag,$itemTag) {
        parent::__construct($tag);
        $this->itemTag = $itemTag;

    }

    /**
     * adds a new item
     * @param string $text
     * @return fily_Control
     */
    public function addItem($text) {
        $control = new fily_ControlContainer($this->itemTag);
        $control->controls->add(new fily_Text($text));
        $this->controls->add($control);
        return $control;
    }
    /**
     * adds a new subcontrol
     * @param fily_ControlToHtml $subControl
     * @return fily_Control
     */
    public function addControl(fily_ControlToHtml $subControl){
         $control = new fily_ControlContainer($this->itemTag);
         $control->controls->add($subControl);
         $this->controls->add($control);
         return $control;
    }


    /**
     * returns the tags for the item
     * @return string
     */
    public function getItemTag() {
        return $this->itemTag;
    }
}
?>
